<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var row = 7;
        //行
        for(var i=1;i<=row;i++){
            //空格 7-i
            var temp = '';
            for(var j=1;j<=7-i;j++){
                temp += ' ';
            }
            //星星数 2i-1
            for(var j=1;j<=2*i-1;j++){
                temp += '*';
            }
            console.log(temp);
        }
    </script>
</body>
</html>